(global.webpackJsonp = global.webpackJsonp || []).push([ [ "uview-ui/components/u-upload/u-upload" ], {
    1715: function(e, t, n) {
        var i = n("d047");
        n.n(i).a;
    },
    1898: function(e, t, n) {
        n.r(t);
        var i, o = n("645e"), s = n("32f8");
        for (i in s) "default" !== i && function(e) {
            n.d(t, e, function() {
                return s[e];
            });
        }(i);
        n("1715");
        var a = n("f0c5"), o = Object(a.a)(s.default, o.b, o.c, !1, null, "2f010004", null, !1, o.a, void 0);
        t.default = o.exports;
    },
    "32f8": function(e, t, n) {
        n.r(t);
        var i, o = n("6e43"), s = n.n(o);
        for (i in o) "default" !== i && function(e) {
            n.d(t, e, function() {
                return o[e];
            });
        }(i);
        t.default = s.a;
    },
    "645e": function(e, t, n) {
        n.d(t, "b", function() {
            return o;
        }), n.d(t, "c", function() {
            return s;
        }), n.d(t, "a", function() {
            return i;
        });
        var i = {
            uIcon: function() {
                return n.e("uview-ui/components/u-icon/u-icon").then(n.bind(null, "bee6"));
            },
            uLineProgress: function() {
                return n.e("uview-ui/components/u-line-progress/u-line-progress").then(n.bind(null, "a3b6"));
            }
        }, o = function() {
            var e = this, t = (e.$createElement, e._self._c, e.showUploadList ? e.$u.addUnit(e.width) : null), n = e.showUploadList ? e.$u.addUnit(e.height) : null, i = !e.disabled && e.maxCount > e.lists.length && !e.customBtn ? e.$u.addUnit(e.width) : null, o = !e.disabled && e.maxCount > e.lists.length && !e.customBtn ? e.$u.addUnit(e.height) : null;
            e.$mp.data = Object.assign({}, {
                $root: {
                    g0: t,
                    g1: n,
                    g2: i,
                    g3: o
                }
            }), "augmented" === e.$scope.data.scopedSlotsCompiler && e.$setScopedSlotsParams("file", {
                file: e.lists
            });
        }, s = [];
    },
    "6e43": function(e, i, o) {
        (function(c) {
            Object.defineProperty(i, "__esModule", {
                value: !0
            }), i.default = void 0;
            var e, s = (e = o("a34a")) && e.__esModule ? e : {
                default: e
            };
            function u(e, t, n, i, o, s, a) {
                try {
                    var r = e[s](a), u = r.value;
                } catch (e) {
                    return n(e), 0;
                }
                r.done ? t(u) : Promise.resolve(u).then(i, o);
            }
            function n(r) {
                return function() {
                    var e = this, a = arguments;
                    return new Promise(function(t, n) {
                        var i = r.apply(e, a);
                        function o(e) {
                            u(i, t, n, o, s, "next", e);
                        }
                        function s(e) {
                            u(i, t, n, o, s, "throw", e);
                        }
                        o(void 0);
                    });
                };
            }
            var t = {
                name: "u-upload",
                props: {
                    showUploadList: {
                        type: Boolean,
                        default: !0
                    },
                    action: {
                        type: String,
                        default: ""
                    },
                    maxCount: {
                        type: [ String, Number ],
                        default: 52
                    },
                    showProgress: {
                        type: Boolean,
                        default: !0
                    },
                    disabled: {
                        type: Boolean,
                        default: !1
                    },
                    imageMode: {
                        type: String,
                        default: "aspectFill"
                    },
                    header: {
                        type: Object,
                        default: function() {
                            return {};
                        }
                    },
                    formData: {
                        type: Object,
                        default: function() {
                            return {};
                        }
                    },
                    name: {
                        type: String,
                        default: "file"
                    },
                    sizeType: {
                        type: Array,
                        default: function() {
                            return [ "original", "compressed" ];
                        }
                    },
                    sourceType: {
                        type: Array,
                        default: function() {
                            return [ "album", "camera" ];
                        }
                    },
                    previewFullImage: {
                        type: Boolean,
                        default: !0
                    },
                    multiple: {
                        type: Boolean,
                        default: !0
                    },
                    deletable: {
                        type: Boolean,
                        default: !0
                    },
                    maxSize: {
                        type: [ String, Number ],
                        default: Number.MAX_VALUE
                    },
                    fileList: {
                        type: Array,
                        default: function() {
                            return [];
                        }
                    },
                    uploadText: {
                        type: String,
                        default: "选择图片"
                    },
                    autoUpload: {
                        type: Boolean,
                        default: !0
                    },
                    showTips: {
                        type: Boolean,
                        default: !0
                    },
                    customBtn: {
                        type: Boolean,
                        default: !1
                    },
                    width: {
                        type: [ String, Number ],
                        default: 200
                    },
                    height: {
                        type: [ String, Number ],
                        default: 200
                    },
                    delBgColor: {
                        type: String,
                        default: "#fa3534"
                    },
                    delColor: {
                        type: String,
                        default: "#ffffff"
                    },
                    delIcon: {
                        type: String,
                        default: "close"
                    },
                    toJson: {
                        type: Boolean,
                        default: !0
                    },
                    beforeUpload: {
                        type: Function,
                        default: null
                    },
                    beforeRemove: {
                        type: Function,
                        default: null
                    },
                    limitType: {
                        type: Array,
                        default: function() {
                            return [ "png", "jpg", "jpeg", "webp", "gif", "image" ];
                        }
                    },
                    index: {
                        type: [ Number, String ],
                        default: ""
                    }
                },
                mounted: function() {},
                data: function() {
                    return {
                        lists: [],
                        isInCount: !0,
                        uploading: !1
                    };
                },
                watch: {
                    fileList: {
                        immediate: !0,
                        handler: function(e) {
                            var n = this;
                            e.map(function(t) {
                                n.lists.some(function(e) {
                                    return e.url == t.url;
                                }) || n.lists.push({
                                    url: t.url,
                                    error: !1,
                                    progress: 100
                                });
                            });
                        }
                    },
                    lists: function(e) {
                        this.$emit("on-list-change", e, this.index);
                    }
                },
                methods: {
                    clear: function() {
                        this.lists = [];
                    },
                    reUpload: function() {
                        this.uploadFile();
                    },
                    selectFile: function() {
                        var n, i, o, s, a, r, u, l = this;
                        this.disabled || (this.name, n = this.maxCount, i = this.multiple, o = this.maxSize, 
                        s = this.sizeType, a = this.lists, this.camera, this.compressed, this.maxDuration, 
                        r = this.sourceType, u = n - a.length, new Promise(function(e, t) {
                            c.chooseImage({
                                count: i ? 9 < u ? 9 : u : 1,
                                sourceType: r,
                                sizeType: s,
                                success: e,
                                fail: t
                            });
                        }).then(function(e) {
                            var t = l.lists.length;
                            e.tempFiles.map(function(e, t) {
                                if (l.checkFileExt(e) && (i || !(1 <= t))) if (e.size > o) l.$emit("on-oversize", e, l.lists, l.index), 
                                l.showToast("超出允许的文件大小"); else {
                                    if (n <= a.length) return l.$emit("on-exceed", e, l.lists, l.index), void l.showToast("超出最大允许的文件个数");
                                    a.push({
                                        url: e.path,
                                        progress: 0,
                                        error: !1,
                                        file: e
                                    });
                                }
                            }), l.$emit("on-choose-complete", l.lists, l.index), l.autoUpload && l.uploadFile(t);
                        }).catch(function(e) {
                            l.$emit("on-choose-fail", e);
                        }));
                    },
                    showToast: function(e) {
                        var t = 1 < arguments.length && void 0 !== arguments[1] && arguments[1];
                        (this.showTips || t) && c.showToast({
                            title: e,
                            icon: "none"
                        });
                    },
                    upload: function() {
                        this.uploadFile();
                    },
                    retry: function(e) {
                        this.lists[e].progress = 0, this.lists[e].error = !1, this.lists[e].response = null, 
                        c.showLoading({
                            title: "重新上传"
                        }), this.uploadFile(e);
                    },
                    uploadFile: function() {
                        var i = arguments, o = this;
                        return n(s.default.mark(function e() {
                            var n, t;
                            return s.default.wrap(function(e) {
                                for (;;) switch (e.prev = e.next) {
                                  case 0:
                                    if (n = 0 < i.length && void 0 !== i[0] ? i[0] : 0, o.disabled) return e.abrupt("return");
                                    e.next = 3;
                                    break;

                                  case 3:
                                    if (o.uploading) return e.abrupt("return");
                                    e.next = 5;
                                    break;

                                  case 5:
                                    if (n >= o.lists.length) return o.$emit("on-uploaded", o.lists, o.index), e.abrupt("return");
                                    e.next = 8;
                                    break;

                                  case 8:
                                    if (100 == o.lists[n].progress) return 0 == o.autoUpload && o.uploadFile(n + 1), 
                                    e.abrupt("return");
                                    e.next = 11;
                                    break;

                                  case 11:
                                    if (!o.beforeUpload || "function" != typeof o.beforeUpload) {
                                        e.next = 22;
                                        break;
                                    }
                                    if ((t = o.beforeUpload.bind(o.$u.$parent.call(o))(n, o.lists)) && "function" == typeof t.then) return e.next = 16, 
                                    t.then(function(e) {}).catch(function(e) {
                                        return o.uploadFile(n + 1);
                                    });
                                    e.next = 18;
                                    break;

                                  case 16:
                                    e.next = 22;
                                    break;

                                  case 18:
                                    if (!1 === t) return e.abrupt("return", o.uploadFile(n + 1));
                                    e.next = 22;
                                    break;

                                  case 22:
                                    if (o.action) {
                                        e.next = 25;
                                        break;
                                    }
                                    return o.showToast("请配置上传地址", !0), e.abrupt("return");

                                  case 25:
                                    o.lists[n].error = !1, o.uploading = !0, c.uploadFile({
                                        url: o.action,
                                        filePath: o.lists[n].url,
                                        name: o.name,
                                        formData: o.formData,
                                        header: o.header,
                                        success: function(e) {
                                            var t = o.toJson && o.$u.test.jsonString(e.data) ? JSON.parse(e.data) : e.data;
                                            [ 200, 201, 204 ].includes(e.statusCode) ? (o.lists[n].response = t, o.lists[n].progress = 100, 
                                            o.lists[n].error = !1, o.$emit("on-success", t, n, o.lists, o.index)) : o.uploadError(n, t);
                                        },
                                        fail: function(e) {
                                            o.uploadError(n, e);
                                        },
                                        complete: function(e) {
                                            c.hideLoading(), o.uploading = !1, o.uploadFile(n + 1), o.$emit("on-change", e, n, o.lists, o.index);
                                        }
                                    }).onProgressUpdate(function(e) {
                                        0 < e.progress && (o.lists[n].progress = e.progress, o.$emit("on-progress", e, n, o.lists, o.index));
                                    });

                                  case 29:
                                  case "end":
                                    return e.stop();
                                }
                            }, e);
                        }))();
                    },
                    uploadError: function(e, t) {
                        this.lists[e].progress = 0, this.lists[e].error = !0, this.lists[e].response = null, 
                        this.$emit("on-error", t, e, this.lists, this.index), this.showToast("上传失败，请重试");
                    },
                    deleteItem: function(i) {
                        var t, o = this;
                        c.showModal({
                            title: "提示",
                            content: "您确定要删除此项吗？",
                            success: (t = n(s.default.mark(function e(t) {
                                var n;
                                return s.default.wrap(function(e) {
                                    for (;;) switch (e.prev = e.next) {
                                      case 0:
                                        if (!t.confirm) {
                                            e.next = 12;
                                            break;
                                        }
                                        if (!o.beforeRemove || "function" != typeof o.beforeRemove) {
                                            e.next = 11;
                                            break;
                                        }
                                        if ((n = o.beforeRemove.bind(o.$u.$parent.call(o))(i, o.lists)) && "function" == typeof n.then) return e.next = 6, 
                                        n.then(function(e) {
                                            o.handlerDeleteItem(i);
                                        }).catch(function(e) {
                                            o.showToast("已终止移除");
                                        });
                                        e.next = 8;
                                        break;

                                      case 6:
                                        e.next = 9;
                                        break;

                                      case 8:
                                        !1 === n ? o.showToast("已终止移除") : o.handlerDeleteItem(i);

                                      case 9:
                                        e.next = 12;
                                        break;

                                      case 11:
                                        o.handlerDeleteItem(i);

                                      case 12:
                                      case "end":
                                        return e.stop();
                                    }
                                }, e);
                            })), function(e) {
                                return t.apply(this, arguments);
                            })
                        });
                    },
                    handlerDeleteItem: function(e) {
                        this.lists[e].process < 100 && 0 < this.lists[e].process && void 0 !== this.lists[e].uploadTask && this.lists[e].uploadTask.abort(), 
                        this.lists.splice(e, 1), this.$forceUpdate(), this.$emit("on-remove", e, this.lists, this.index), 
                        this.showToast("移除成功");
                    },
                    remove: function(e) {
                        0 <= e && e < this.lists.length && (this.lists.splice(e, 1), this.$emit("on-list-change", this.lists, this.index));
                    },
                    doPreviewImage: function(e, t) {
                        var n, i = this;
                        this.previewFullImage && (n = this.lists.map(function(e) {
                            return e.url || e.path;
                        }), c.previewImage({
                            urls: n,
                            current: e,
                            success: function() {
                                i.$emit("on-preview", e, i.lists, i.index);
                            },
                            fail: function() {
                                c.showToast({
                                    title: "预览图片失败",
                                    icon: "none"
                                });
                            }
                        }));
                    },
                    checkFileExt: function(e) {
                        var t = !1, n = e.path.replace(/.+\./, "").toLowerCase();
                        return (t = this.limitType.some(function(e) {
                            return e.toLowerCase() === n;
                        })) || this.showToast("不允许选择".concat(n, "格式的文件")), t;
                    }
                }
            };
            i.default = t;
        }).call(this, o("543d").default);
    },
    d047: function(e, t, n) {}
} ]), (global.webpackJsonp = global.webpackJsonp || []).push([ "uview-ui/components/u-upload/u-upload-create-component", {
    "uview-ui/components/u-upload/u-upload-create-component": function(e, t, n) {
        n("543d").createComponent(n("1898"));
    }
}, [ [ "uview-ui/components/u-upload/u-upload-create-component" ] ] ]);